package com.yunduo.schedule.TimerTask;

import com.yunduo.common.RetunData.statuscode.impl.ServerCode;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.TimerTask;

/**
 * 用户退出的定时任务
 */
public class UserOutLoginTask extends TimerTask {
    private RedisTemplate redisTemplate;
    private String taskName;

    public UserOutLoginTask(String taskName,RedisTemplate redisTemplate) {
        this.taskName = taskName;
        this.redisTemplate = redisTemplate;
    }

    @Override
    public void run() {
        redisTemplate.opsForSet().remove(ServerCode.ONLINE_ACCOUNT_TOTAL.getInfo(),taskName);
    }
}